package com.filldream.fastboot.common.okutil.stocktest;

import com.filldream.fastboot.common.okutil.stock.StockOrderUtil;
import com.filldream.fastboot.common.okutil.stock.TransactionBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Arrays;

/**
 * 股票订单
 */
@Data
@Accessors(chain = true)
public class StockOrder2 extends TransactionBase {

    @ApiModelProperty(value = "股票代码")
    private String code;

    @ApiModelProperty(value = "购买价格")
    private String price;

    @ApiModelProperty(value = "购买数量")
    private Integer count = 100;

    @ApiModelProperty(value = "交易类型")
    private Boolean isBuy;

    /**
     * 获取保本价格
     * @return
     */
    public String getBreakEvenPrice(){
        return StockOrderUtil.getBreakEvenPrice(this, "0");
    }

    public static void main(String[] args) {
        StockOrder2 buyOrder1 = new StockOrder2();
        buyOrder1.setPrice("9.546").setCount(200).setIsBuy(true);

        StockOrder2 buyOrder2 = new StockOrder2();
        buyOrder2.setPrice("7.546").setCount(200).setIsBuy(false);
        System.out.println(StockOrderUtil.getOrderProfit(buyOrder1, buyOrder2));

    }

}
